package hangman.Ana.Gilles;

import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

//This is the main screen
public class HangManActivity extends Activity implements OnClickListener {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        //set up click listeners
        View newButton = findViewById(R.id.new_button);
        newButton.setOnClickListener(this);
        View aboutButton = findViewById(R.id.about_button);
        aboutButton.setOnClickListener(this);
        View exitButton = findViewById(R.id.exit_button);
        exitButton.setOnClickListener(this);
    }
    
    //set the actions buttons on the screen
    public void onClick(View v){
    	Intent j = new Intent ();
    	switch(v.getId()){
    	//open a new game
    	case R.id.new_button:
    		j = new Intent (this, Game.class);
    		startActivity(j);
    		break;
    		
    	//get information about the game
    	case R.id.about_button:
    		j = new Intent (this, About.class);
    		startActivity(j);
    		break;	
    		
        //get information about the game
        case R.id.exit_button:
        	finish();
            System.exit(0);
        	break;
    	}
    } 
}


